Skip to main content link. Accesskey S
  • Help
  • HCL Logo
  • HCL Notes and Domino Application Development wiki
  • THIS WIKI IS READ-ONLY. Individual names altered for privacy purposes.
  • HCL Forums and Blogs
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • API Documentation
Search
Community Articles > Developing Applications > Launching the first attachment of a document from a docLink
  • Share Show Menu▼
  • Subscribe Show Menu▼

Recent articles by this author

Launching the first attachment of a document from a docLink

Simple way to have the attachment of a document be launched upon clicking a docLink.
Community articleLaunching the first attachment of a document from a docLink
Added by ~Bella Umwelyflar on March 29, 2010 | Version 1
  • Actions Show Menu▼
expanded Abstract
collapsed Abstract
Simple way to have the attachment of a document be launched upon clicking a docLink.
, email, URL, docLink
Launching the first attachment of a document from a docLink
 
I had a request to send a docLink in an email message that when clicked would not just open the Lotus Notes document, but would rather open the first attachment stored in the document.
 
I knew I could do it with a url from the browser with something like this:
 
server/filepath/filename/view/docid/$file/filename?openelement
 
But I wasn't sure how to meet the requirement in the Notes client with a docLink.
 
I spoke with Chris Toohey and Jamie Magee and they both what I will discuss below, except both indicated that the url would work in the notes client use if you put Notes://server/filepath/filename/view/docid/$file/filename?openelement.
The idea worked, but I couldn't get the url to work. But a regular docLink worked which is better than a URL.
 
First create a form, call it (launcher) | launcher. The form does not need any fields on it. Set the Form Launch property>Auto Launch to First Attachment.
 
Then create a view, call it (fileLauncher) | fileLauncher. Put one column in the view. The formula for the column should be @Text(@documentUniqueId). Make sure the column is sorted.
 
In the Form Formula of the view, put "launcher".
 
To create a mail message with a docLink that launches the attachment, I then created an action button on the form where the attachments are stored with the following code:
 
Sub Click(Source As Button)
 Dim workspace As New NotesUIWorkspace
 Dim uiDoc As NotesUidocument
 Dim doc As NotesDocument
 Dim session As New NotesSession
 Dim db As NotesDatabase
 Dim view As NotesView
 Dim launcherDoc As NotesDocument
 Dim memo As NotesDocument
 Dim rtitem As NotesRichTextItem
 
 Set uidoc = workspace.currentdocument
 Set doc = uidoc.document
 
 Set db = session.currentdatabase
 Set view = db.getview("fileLauncher")
 Set launcherDoc = view.GetDocumentByKey(doc.UniversalID)
 If launcherDoc Is Nothing Then
 Else
  Set memo = db.CreateDocument
  Set rtitem = New NotesRichTextItem(memo,"Body")
  Call rtitem.AppendDocLink(launcherDoc,"launch attachment")
  memo.sendto= "Betsy Thiede"
  Call memo.Send(False)
 End If
End Sub
 
When I received the mail message, and clicked on the docLink, the attachment opened up just like I wanted it to. Hooray.
 
If I just used the code listed below, the document opened, but not the attachment.
 
Sub Click(Source As Button)
    Dim workspace As New NotesUIWorkspace
    Dim uiDoc As NotesUidocument
    Dim doc As NotesDocument
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim view As NotesView
    Dim launcherDoc As NotesDocument
    Dim memo As NotesDocument
    Dim rtitem As NotesRichTextItem
 
    Set uidoc = workspace.currentdocument
    Set doc = uidoc.document
 
    Set db = session.currentdatabase
    Set memo = db.CreateDocument
    Set rtitem = New NotesRichTextItem(memo,"Body")
    Call rtitem.AppendDocLink(doc,"docLink")
     memo.sendto= "Betsy Thiede"
     Call memo.Send(False)

End Sub

  • Actions Show Menu▼


expanded Attachments (0)
collapsed Attachments (0)
Edit the article to add or modify attachments.
expanded Versions (1)
collapsed Versions (1)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (1)Mar 29, 2010, 2:04:47 PM~Bella Umwelyflar  
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedAbout
  • HCL Software
  • HCL Digital Solutions community
  • HCL Software support
  • BlogsDigital Solutions blog
  • Community LinkHCL Software forums and blogs
  • About HCL
  • Privacy
  • Accessibility